<template>
    <el-container>
        <el-header class="header-tabs">
            <el-tabs type="card" v-model="groupId" @tab-change="tabChange">
				<el-tab-pane label="待创建合同" name="0"></el-tab-pane>
				<el-tab-pane label="缝挑合同明细" name="1"></el-tab-pane>
			</el-tabs>
        </el-header>
        <el-header v-if="groupId == 0">
            <div class="right-panel-search">
                <el-input v-model="search.order_no" placeholder="订单号" clearable @change="handleKeyDown"/>
				<el-input v-model="search.keyword" placeholder="工厂货号/批次号" clearable @change="handleKeyDown"/>
                <el-date-picker v-model="search.time_range" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :size="size" style="width:220px" />
                <el-button type="primary" icon="el-icon-search" @click="waitUpsearch">搜索</el-button>

            </div>
        </el-header>
        <el-main class="nopadding" v-if="groupId == 0">
            <scTable ref="table" :apiObj="apiObj" @selection-change="selectionChange" stripe remoteSort remoteFilter border :params="query" show-summary :summary-method="getSummaries">
                <el-table-column type="selection" width="50"></el-table-column>
                <el-table-column fixed label="订单号" align="center" width="160">
                    <template #default="{row}">
                        <div>{{row.order_no}}</div>
                        <div>{{row.create_time}}</div>
                    </template>
                </el-table-column>
                <el-table-column label="商品信息" fixed prop="goods" align="center" width="300">
                    <template #default="{row}">
                        <div class="shopInfo" v-if="row.goods">
                            <el-image class="img" :src="row.goods.goods_image" :preview-src-list="row.goods.goods_image_item" :initial-index="0" fit="cover" preview-teleported="true" hide-on-click-modal />
                            <div class="right">
                                <div>工厂货号：{{row.factory_number}}</div>
                                <div>批次号：{{row.batch_number}}</div>
                                <div>SKC：{{row.skc}}</div>
                                <div>商品品牌：{{row.brand_name}}</div>
                                <div>客户：{{row.custom_name}}</div>
                                <div>颜色：{{row.goods.colour}}</div>
                                <div v-if="row.sizeCate">商品类别：{{row.sizeCate.title}}</div>
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column fixed label="尺码" align="center">
                    <template #default="{row}">
                        <div v-for="(item,index) in row.orderDetail" :key="index">
                            {{item.goods_size}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column fixed label="下单数量" prop="total_count" align="center" width="100">
                    <template #default="{row}">
                        <div v-for="(item,index) in row.orderDetail" :key="index">
                            {{item.num}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="计划生产数" prop="produce_count" align="center" width="105">
                    <template #default="{row}">
                        <div v-for="(item,index) in row.orderDetail" :key="index">
                            {{item.produce_num}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="织机收货数量" prop="loom_count" align="center" width="105">
                    <template #default="{row}">
                        <div v-for="(item,index) in row.orderDetail" :key="index">
                            {{item.pending_all_num}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="待缝挑数量" prop="pending_total" align="center" width="105">
                    <template #default="{row}">
                        <div v-for="(item,index) in row.orderDetail" :key="index">
                            {{item.pending_num}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="已缝挑数量" prop="weaving_count" align="center" width="300">
                    <template #default="{row}">
                        <div v-for="(item,index) in row.orderDetail" :key="index">
                            {{item.weaving_num}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="订单标签" align="center" width="100">
                    <template #default="scope">
                        <el-tag v-if="scope.row.order_label==1" type="danger">加急</el-tag>
                        <el-tag v-else type="success">正常</el-tag>
                    </template>
                </el-table-column>
                <el-table-column label="针种" prop="needle_seed_name" align="center"></el-table-column>
                <el-table-column label="毛种" prop="wool_seed" align="center"></el-table-column>
                <el-table-column label="生产交期" prop="deliver_time" align="center" width="100" sortable></el-table-column>
                <el-table-column label="下单人" align="center" column-key="filterCreate" :filters="createFilters">
                    <template #default="{row}">
                        {{ row.creator_name }}
					</template>
                </el-table-column>
				<el-table-column label="制单人" align="center" column-key="filterMain" :filters="zhiFilters">
                    <template #default="{row}">
                        {{ row.maintenance_name }}
					</template>
                </el-table-column>
                <el-table-column label="操作" fixed="right" align="center" width="120">
                    <template #default="scope">
                        <el-button-group style="display:flex;flex-direction:column">
                            <el-button text type="primary" size="small" @click="showContract(scope.row, scope.$index)" v-auth="'sewing.show'">查看委外合同单</el-button>
                            <el-button text type="primary" size="small" @click="goContract(scope.row, scope.$index)" v-auth="'sewing.contract'">新建委外合同单</el-button>
                        </el-button-group>
                    </template>
                </el-table-column>
            </scTable>
        </el-main>
        <el-header v-if="groupId == 1">
            <div class="right-panel-search">
                <!-- <el-button type="primary" @click="scan" v-auth="'sewing.scanSend'">缝挑扫码收货</el-button> -->
                <el-button type="primary" @click="send" v-auth="'sewing.send'">缝挑电子秤收货</el-button>
                <el-button type="primary" @click="sendInput" v-auth="'sewing.Input'">缝挑收货录入</el-button>
                <el-input v-model="search.contract_no" placeholder="请输入合同单号" clearable @change="handleKeyDowns" />
                <el-input v-model="search.order_no" placeholder="请输入订单号" clearable @change="handleKeyDowns" />
                <el-input v-model="search.keyword" placeholder="请输入工厂货号/SKC" clearable @change="handleKeyDowns" />
                <el-button type="primary" icon="el-icon-search" @click="conUpsearch">搜索</el-button>
                <el-button type="primary" @click="allCompleted" v-auth="'sewing.completedAll'" :disabled="selection.length==0">批量完工</el-button>
            </div>
        </el-header>
        <el-main class="nopadding" v-if="groupId == 1">
            <scTable ref="table" :apiObj="fazhi"  @selection-change="selectionChanges" stripe remoteSort remoteFilter border :params="query2" show-summary>
                <el-table-column type="selection" width="50"></el-table-column>
                <el-table-column fixed label="合同号" align="center" width="160" sortable>
                    <template #default="{row}">
                        <div>{{row.contract_no}}</div>
                        <div>{{row.create_time}}</div>
                        <div>{{row.order_no}}</div>
                    </template>
                </el-table-column>
                <el-table-column label="商品信息" fixed align="center" width="300">
                    <template #default="{row}">
                        <div class="shopInfo" v-if="row.goods">
                            <el-image class="img" :src="row.goods.goods_image" :preview-src-list="row.goods.goods_image_item" :initial-index="0" fit="cover" preview-teleported="true" hide-on-click-modal />
                            <div class="right">
                                <div>工厂货号：{{row.factory_number}}</div>
                                <div>批次号：{{row.batch_number}}</div>
                                <div>SKC：{{row.skc}}</div>
                                <div>商品品牌：{{row.brand_name}}</div>
                                <div>客户：{{row.custom_name}}</div>
                                <div>颜色：{{row.goods.colour}}</div>
                                <div v-if="row.sizeCate">商品类别：{{row.sizeCate.title}}</div>
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column fixed label="尺码" align="center">
                    <template #default="{row}">
                        <div v-for="(item,index) in row.orderDetail" :key="index">
                            {{item.goods_size}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column fixed label="此单缝挑数量" prop="total_weaving_count" align="center" width="100">
                    <template #default="{row}">
                        <div v-for="(item,index) in row.orderDetail" :key="index">
                            {{item.weaving_num}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column fixed label="已收数量" prop="total_complete_count" align="center" width="100">
                    <template #default="{row}">
                        <div v-for="(item,index) in row.orderDetail" :key="index">
                            {{item.complete_num}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column fixed label="未收数量" prop="total_can_take_count" align="center" width="100">
					<template #default="{row}">
						<div v-for="(item,index) in row.orderDetail" :key="index">
							{{ item.can_take_num }}
						</div>
					</template>
				</el-table-column>
                <el-table-column label="已缝挑数量" prop="weaving_count" align="center" width="300">
                    <template #default="{row}">
                        <div v-for="(item,index) in row.orderDetail" :key="index">
                            {{item.scan_num}}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="订单标签" align="center" width="100">
                    <template #default="scope">
                        <el-tag v-if="scope.row.order_label==1" type="danger">加急</el-tag>
                        <el-tag v-else type="success">正常</el-tag>
                    </template>
                </el-table-column>
                <el-table-column label="针种" prop="needle_seed_title" align="center" width="100" column-key="filterNeedle" :filters="needleFilters"></el-table-column>
                <el-table-column label="毛种" align="center" width="120">
                    <template #default="{row}">
						<div>{{row.wool_seed}}</div>
					</template>
                </el-table-column>
                <el-table-column label="发缝日期" prop="contract_date" align="center" width="150" sortable></el-table-column>
                <el-table-column label="生产交期" prop="due_date" align="center" width="150" sortable>
                    <template #default="scope">
                        <div v-if="scope.row.take_delivery_date>scope.row.due_date" style="color:#67c23a">{{scope.row.due_date}}天</div>
                    </template>
                </el-table-column>
                <el-table-column label="工序" align="center" width="100" column-key="filterProcess" :filters="processFilters">
                    <template #default="{row}">
						<div>{{row.produce_process_name}}</div>
					</template>
                </el-table-column>
                <el-table-column label="承制人" align="center" width="100" sortable column-key="filterApply" :filters="chengFilters">
					<template #default="{row}">
						<div>{{row.apply_name}}</div>
					</template>
				</el-table-column>
				<el-table-column label="发缝人" align="center" width="100" sortable column-key="filterCreate" :filters="zhiFilters">
                    <template #default="{row}">
						<div>{{row.creator_name}}</div>
					</template>
                </el-table-column>
                <el-table-column label="单价" prop="price" align="center" width="100" sortable></el-table-column>
                <el-table-column label="单位" prop="unit_name" align="center" width="100"></el-table-column>
                <el-table-column label="完工" align="center" width="100" column-key="is_completed" :filters="[{ text: '是', value: '1' }, { text: '否', value: '0' }]">
                    <template #default="{row}">
                        <el-tag v-if="row.is_completed==1" type="success">是</el-tag>
                        <el-tag v-else type="danger">否</el-tag>
                    </template>
                </el-table-column>
                <el-table-column label="完工日期" align="center" width="100" sortable>
                    <template #default="{row}">
						<div>{{row.completed_date}}</div>
					</template>
                </el-table-column>
                <el-table-column label="结算月份" align="center" width="100" sortable>
                    <template #default="{row}">
						<div>{{row.settlement_date}}</div>
					</template>
                </el-table-column>
                <el-table-column label="操作" fixed="right" align="center" width="120">
                    <template #default="scope">
                        <el-button-group style="display:flex;flex-direction:column">
                            <div v-if="contract">
                                <sc-status-indicator type="danger" v-if="scope.row.contract_print==0"></sc-status-indicator>
                                <el-button text type="primary" size="small" @click="contPrint(scope.row, scope.$index)" v-auth="'sewing.print'">打印合同</el-button>
                            </div>
                            <el-popconfirm title="确定作废该合同单吗?" @confirm="voidContract(scope.row)">
								<template #reference>
									<el-button text type="danger" size="small" v-auth="'sewing.void'">合同单作废</el-button>
								</template>
							</el-popconfirm>
                            <el-button text type="warning" size="small" @click="princeChange(scope.row, scope.$index)" v-auth="'sewing.checkPrice'">修改价格</el-button>
                            <el-popconfirm title="确定标为完工吗？" @confirm="completed(scope.row)" v-if="scope.row.is_completed==0">
								<template #reference>
									<el-button text type="success" size="small" v-auth="'sewing.completed'">标为完工</el-button>
								</template>
							</el-popconfirm>
                            <el-popconfirm title="确定取消完工吗？" @confirm="unCompleted(scope.row)" v-if="scope.row.is_completed==1">
								<template #reference>
									<el-button text type="info" size="small" v-auth="'sewing.uncompleted'">取消完工</el-button>
								</template>
							</el-popconfirm>
                        </el-button-group>
                    </template>
                </el-table-column>
            </scTable>
        </el-main>
        <con-save v-if="dialog.save" ref="saveDialog" @success="contractClose" @closed="dialog.save = false" draggable></con-save><!-- 新增委外合同-->
        <contract-list v-if="dialog.list" ref="listDialog" @success="handleSuccess" @closed="dialog.list = false" draggable :query="{produce_no:produce_no,process_id:4}"></contract-list><!-- 查看合同-->
        <scan-send v-if="dialog.scan" ref="scanDialog" @success="handleSuccess" @closed="dialog.scan = false" draggable></scan-send><!-- 点击头部中的收货-->
        <print ref="pitDialog"></print> <!-- 打印 -->
        <operate-send v-if="dialog.operate" ref="operateDialog" @success="printClose" @closed="dialog.operate = false" draggable></operate-send><!-- 点击操作中的收货-->
        <send-input v-if="dialog.input" ref="inputDialog" @success="inputClose" @closed="dialog.input = false" draggable></send-input>
        <receipt-print v-if="dialog.prints" ref="prinstDialog" @success="handleSuccess" @closed="dialog.prints = false" draggable></receipt-print>
        <contract-print v-if="dialog.print" ref="printDialog" @success="handleSuccess" @closed="dialog.print = false" draggable></contract-print>
        <price-check v-if="dialog.price" ref="priceDialog" @success="handleSuccess" @closed="dialog.price = false" draggable></price-check><!-- 修改价格 -->
        <el-dialog v-model="dialog.printType" title="您将打印条码,请选择打印需求" width="300" :before-close="handleClose" align-center>
            <el-form-item label="是否打印公司名" prop="corporate">
				<el-switch v-model="corporate" :active-value="1" :inactive-value="0"></el-switch>
			</el-form-item>
            <el-form-item label="是否打印客户名" prop="custom">
				<el-switch v-model="custom" :active-value="1" :inactive-value="0"></el-switch>
			</el-form-item>
            <el-form-item label="是否打印成分" prop="component">
				<el-switch v-model="component" :active-value="1" :inactive-value="0"></el-switch>
			</el-form-item>
            <template #footer>
                <div class="dialog-footer">
                    <el-button @click="dialog.send = false">取消</el-button>
                    <el-button type="primary" @click="printQr" :loading="isSaveing">确定</el-button>
                </div>
            </template>
        </el-dialog>
    </el-container>
</template>
<script>
import Print from '@/views/order/print';
import ContractList from './contractList';
import ConSave from './conSave.vue';
import ScanSend from './scanSend.vue';
import OperateSend from './operateSend.vue';
import SendInput from './sendInput.vue';
import receiptPrint from '../../produceLoom/send/receiptPrint.vue';
import ContractPrint from './contractPrint.vue';
import PriceCheck from '../../produceLoom/contract/priceCheck.vue';
export default {
  components: { Print, ContractList, ConSave, ScanSend, OperateSend, SendInput,receiptPrint, ContractPrint, PriceCheck },
	name: 'user',
	data() {
		return {
            dialog:{
                save:false,
                scan:false,
                pit:false,
                list:false,
                repair:false,
                operate:false,
                printType:false,
                input:false,
                print:false,
                prints:false,
                price:false,
            },
			group: [],
			apiObj: this.$API.produce.getProduce.lists,
            fazhi: this.$API.produce.contract.viewContract,
            query:{
                planned_speed:3,
                plan_type:0
            },
            query2:{
                process_id:4,
            },
			selection: [],
            needleList:[],//针种
			search: {
				time_range: null,
				keyword: null,
                supplier_id:null,
                creator:null,
                order_no:null,
			},
            produce_no:"",
            groupId:"0",
            apply:[],
            applyList:[],
            printID:"",
            isSaveing: false,
            corporate:0,
            custom:0,
            component:0,
            chengFilters: [],
			zhiFilters: [],
            createFilters:[],
            needleFilters:[],
            processFilters:[],
            place:1,
            contract:this.$TOOL.data.get("PERMISSIONS").includes('sewing.print'),
		}
	},
	mounted() {
        this.getCreate()
    },
	methods: {
        // 查看委外合同单
        showContract(row) {
            this.produce_no = row.produce_no
			this.dialog.list = true
			this.$nextTick(() => {
				this.$refs.listDialog.open('add').setData(row)
			})
		},
        // 打印合同单
        async contPrint(row){
            // console.log('row :>> ', row);
            // this.dialog.print = true;
            // setTimeout(()=>{
            //     this.$refs.printDialog.open("show");
            // },500)
            var reqData = { contract_no_arr: row.contract_no };
			var res = await this.$API.print.contractPrint.get(reqData);
			if (res.code == 1) {
			    this.dialog.print = true;
			    setTimeout(()=>{
			        this.$refs.printDialog.open("show").setData(res.data);
			    },500)
                this.conUpsearch()
			} else {
				this.$alert(res.message, "提示", { type: "error" });
			}
        },
        // 修改价格
        princeChange(row) {
			this.dialog.price = true
			this.$nextTick(() => {
				this.$refs.priceDialog.open('edit').setData(row)
			})
		},
        async voidContract(row) {
			var reqData = {contract_no_arr: row.contract_no}
			var res = await this.$API.produce.void.post(reqData);
			if (res.code == 1) {
				this.$refs.table.refresh()
				this.$message.success("操作成功")
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
        // 新建委外合同单
        goContract(row) {
			this.dialog.save = true
			this.$nextTick(() => {
				this.$refs.saveDialog.open('add').setData(row)
			})
		},
        //标记完工
		async completed(row) {
			var reqData = { contract_no_arr: row.contract_no }
			var res = await this.$API.produce.send.markCompleted.post(reqData);
			if (res.code == 1) {
                this.$refs.table.refresh()
				this.$message.success("操作成功")
			} else {
				this.$alert(res.message, "提示", { type: 'error' })
			}
		},
         // 取消完工
        async unCompleted(row) {
			var reqData = {contract_no_arr: row.contract_no}
			var res = await this.$API.produce.send.unCompleted.post(reqData);
			if (res.code == 1) {
				this.$refs.table.refresh()
				this.$message.success("操作成功")
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
        /**批量完工*/
		async allCompleted() {
			var contract_no_arr = [];
			this.selection.map((item) => {
				contract_no_arr.push(item.contract_no)
			})
			this.$confirm(`确定完工选中的 ${this.selection.length} 项吗？`, '提示', {
				type: 'warning'
			}).then(() => {
				this.table_del_all(contract_no_arr)
			}).catch(() => {

			})
		},
        async table_del_all(contract_no_arr) {
			var reqData = {contract_no_arr: contract_no_arr}
			var res = await this.$API.produce.send.markCompleted.post(reqData);
			if (res.code == 1) {
				this.$refs.table.refresh()
				this.$message.success("操作成功")
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
        // 补打条码
        goRepair() {
			this.dialog.repair = true
			this.$nextTick(() => {
				this.$refs.repairDialog.open('edit').setData(this.selection[0])
			})
		},
        // 织机扫码收货
        scan() {
			this.dialog.scan = true
			this.$nextTick(() => {
				this.$refs.scanDialog.open('add')
			})
		},
        // 电子秤收货
        send() {
            if(this.selection.length > 1){
                this.$message.error("请选择一条数据！")
                return
            }
            this.dialog.operate = true;
			this.$nextTick(() => {
				this.$refs.operateDialog.open("add").setData(this.selection[0]);
			});
		},
        // 收货录入
        sendInput() {
            if(this.selection.length > 1){
                this.$message.error("请选择一条数据！")
                return
            }
            this.dialog.input = true;
			this.$nextTick(() => {
				this.$refs.inputDialog.open("add").setData(this.selection[0]);
			});
		},
        // 打印
        async print(row){
            var reqData = { contract_no_arr:row.contract_no };
            var res = await this.$API.print.loomBarcodePrint.get(reqData);
            if (res.code == 1) {
                this.$refs.pitDialog.init(res.data);
            } else {
                this.$alert(res.message, "提示", { type: "error" });
            }
        },
        async printQr(){
            this.isSaveing = true;
            var res = await this.$API.print.loomBarcodePrint.get(this.printID);
            this.isSaveing = false;
            if (res.code == 1) {
                this.$refs.pitDialog.init(res.data);
                this.dialog.printType = false
            } else {
                this.$alert(res.message, "提示", { type: "error" });
            }
        },
		//搜索
        waitUpsearch() {
            this.$refs.table.upData(this.search)
		},
        conUpsearch() {
            this.$refs.table.upData(this.search)
		},
		//本地更新数据
		handleSuccess(data, mode) {
			if (mode == 'add') {
				this.$refs.table.refresh()
			} else if (mode == 'edit') {
				this.$refs.table.refresh()
			} else if (mode == 'set') {
				this.$refs.table.refresh()
			}
		},
        selectionChanges(selection) {
			this.selection = selection;
		},
        tabChange(e){
            this.groupId = e
            for (const key in this.search) {
                this.search[key] = null;
            }
            this.place = Number(e )+ 1
            this.getCreate()
            if(e==1){
                this.conUpsearch()
            }else{
                this.waitUpsearch()
            }
        },
        //所有针种
        async getNeedle(){
            var res = await this.$API.all.needle.get();
            this.needleList = res.data;
        },
        handleKeyDown() {
            this.waitUpsearch()
        },
        handleKeyDowns() {
            this.conUpsearch()
        },
		filterHandler(value, row, column) {
			const property = column['property']
			return row[property] === value
		},
        // 下单人/制单人
        async getCreate() {
            var res = await this.$API.all.getProduceFilter.get({process_id:4,place:this.place});
			let order = []
			let maintenance = []
			let cheng = []
			let needle = []
			let process = []
            res.data.maintenance_creator.map(item => {
                maintenance.push({
                    text: item.name,
                    value: item.id,
                })
            })
            if(this.place==1){
                res.data.order_creator.map(item => {
				order.push({
					text: item.name,
					value: item.id,
				})
			})
            }else if(this.place==2){
                res.data.supplier_list.map(item => {
                    cheng.push({
                        text: item.name,
                        value: item.id,
                    })
                })
                res.data.needle_seed_list.map(item => {
                    needle.push({
                        text: item.title,
                        value: item.id,
                    })
                })
                res.data.process_list.map(item => {
                    process.push({
                        text: item.title,
                        value: item.id,
                    })
                })
            }
			this.createFilters = order
			this.zhiFilters = maintenance
			this.chengFilters = cheng
            this.needleFilters = needle
			this.processFilters = process
		},
        printClose(data, mode,c) {
			if (mode == 'add') {
				this.$refs.table.refresh()
			} else if (mode == 'edit') {
				this.$refs.table.refresh()
			} else if (mode == 'set') {
				this.$refs.table.refresh()
			}
            if(c==undefined){
                console.log(11.02);
            }else{
                this.dialog.prints = true;
                setTimeout(()=>{
                    this.$refs.prinstDialog.open("show").setData(c);
                },500)
            }
		},
        inputClose(data, mode,c) {
			if (mode == 'add') {
				this.$refs.table.refresh()
			} else if (mode == 'edit') {
				this.$refs.table.refresh()
			} else if (mode == 'set') {
				this.$refs.table.refresh()
			}
            if(c==undefined){
                console.log(11.02);
            }else{
                this.dialog.prints = true;
                setTimeout(()=>{
                    this.$refs.prinstDialog.open("show").setData(c);
                },500)
            }
		},
        contractClose(data, mode, c) {
            if (mode == 'add') {
				this.$refs.table.refresh()
			} else if (mode == 'edit') {
				this.$refs.table.refresh()
			} else if (mode == 'set') {
				this.$refs.table.refresh()
			}
            if(c==undefined){
                console.log(11.02);
            }else{
                this.dialog.print = true;
                setTimeout(()=>{
                    this.$refs.printDialog.open("show").setData(c);
                },500)
            }
		},
        getSummaries(param){
            const { columns, data } = param
            var sums = []
            columns.forEach((column, index) => {
                sums[index] = 0
                if (index === 0) {
                    sums[index] = '合计'
                    return
                }
                if (index === 1 || index ===2 || index === 3 ||  index === 8 || index === 9 || index === 10 || index === 11 || index === 12 || index === 13 || index === 15 || index === 16 || index === 17 || index === 18) {
                    sums[index] = ''
                    return
                }
                if(column.property != undefined){
                    data.map((item) => {
                        if(item[column.property] && item[column.property].constructor === Array && column.property != 'total_num'){
                            sums[index] += item[column.property].length
                        }else{
                            sums[index] += Number(item[column.property])
                        }
                    })
                }
            })
            return sums
        },
	}
}
</script>

<style>
.search-input {
	width: auto;
	font-size: 14px;
}
</style>
